<?php

include_once('../../php/postgre.php');
$idp = $_GET['idp'];
if (is_numeric($idp)) {  
    $jns_pel = get_data("Select * from spm_jenis_pelayanan where id_pelayanan = '$idp'");
    $rw = get_data("SELECT COUNT(*) as cnt from spm_indikator where id_pelayanan = '$idp'");
    $kdpel = $jns_pel['id_pelayanan'];
    $vlue = $rw['cnt'] + 1;
    $kodeindikator = ($vlue <= 9) ? "0" . $vlue : $vlue;
    $kd = $kdpel . "." . $kodeindikator;
    echo $kd;
}
?>